package com.antgroup.seckill.business.utils;

import com.antgroup.seckill.business.common.enums.SequenceNameEnum;

import java.util.Date;
import java.util.UUID;

/**
 * @author wangxy
 * @date 2024/7/27 14:37
 */
public class UUIDUtil {

    /** yyyymm格式 */
    public static String  YYYYMM_FORMAT                = "yyyy-MM-dd HH:mm:ss";

    /** 东8区 */
    private static String  BEIJING_TIME_ZONE            = "Asia/Shanghai";


    public static String uuid() {
        return UUID.randomUUID().toString().replace("-","");
    }


  /*  public long genUnifyID(SequenceNameEnum seqName) {
        StringBuilder id = new StringBuilder();

        //日期转换:8位yyyyMMdd格式
        String today = DateUtil.getFormatTime(new Date(), YYYYMM_FORMAT,BEIJING_TIME_ZONE);

        //8位日期
        id.append(today);

        //1位数据版本位
        id.append("1");

        //1位当前区域位
        id.append("1");

        //9位sequence
        id.append(getFixLengthSeqValue(String.valueOf(getNextSeqValue(seqName)), 9));

        return Long.valueOf(id.toString());
    }

    private long getNextSeqValue(SequenceNameEnum sequenceNameEnum) {
        SequenceResult sequence = shardingSequence.getNextValue(
                RegionCodeUtil.getSequenceName(sequenceNameEnum.getSeqName()), "REAL", SEQ_PARA);

        return Long.parseLong(sequence.getSequenceValue());
    }*/

    public static void main(String[] args) {
        String s = uuid();
        System.out.println(s);
    }
}
